package com.fowo.api.sys.controller;

import java.util.List;

import javax.annotation.Resource;

import com.fowo.api.sys.model.SysAreaVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fowo.api.common.model.R;
import com.fowo.api.sys.entity.SysArea;
import com.fowo.api.sys.model.SysAreaSearchParamPo;
import com.fowo.api.sys.service.SysAreaService;

import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "区域")
@RestController
@RequestMapping("/api/sys/area")
public class SysAreaController {

    @Resource
    private SysAreaService sysAreaService;

    @GetMapping
    public R<List<SysArea>> search(SysAreaSearchParamPo search) {
        return R.data(() -> sysAreaService.search(search));
    }

    @GetMapping("tree")
    public R<List<SysAreaVo>> tree(SysAreaSearchParamPo search) {
        return R.data(() -> sysAreaService.tree(search));
    }
}
